<?php

namespace App\Model;


use App\Model\Traits\Common;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;

class Article extends Model
{
    use Common,LogsActivity;

    //设置记录的动态属性
    protected static $logFillable=true;
    //记录事件
    protected static $recordEvents=['created','updated'];
    //自定义日志名称
    protected static $logName='article';

    protected $fillable=['title','content'];

    public function getlink($param){
        return route('article.show',$this).$param;
    }

    public function getMarkdownAttribute (  )
    {
        $Parsedown = new \Parsedown();

        return $Parsedown->text($this->content);
    }
}
